﻿package com.pool.data
{
	import SpLib.Net.RPC;
	
	import flash.events.EventDispatcher;
	
	public class DataMgr extends EventDispatcher
	{
		private static var _instance:DataMgr;
		
		public var m_nAID:uint = 0;
		public var m_nLoginKey:uint = 0;
		
		public var m_sMeNetKey:String = "";
		public var m_pMeUserData:UserData;
		
		public function DataMgr()
		{
			if(s_Instance!=null)
			{
				throw new Error("DataMgr is Singleton");
			}
		}

		public static function get Instance():DataMgr
		{
			if(_instance==null)
			{
				_instance = new DataMgr();
			}
			
			return _instance;
		}
		
		public function LoginOk(aid:uint,loginkey:uint):void
		{
			m_nAID = aid;
			m_nLoginKey = loginkey;
		}
		
		public function LoadDataOk(netkey:String,data:Array):void
		{
			m_sMeNetKey = netkey;
			m_pMeUserData = new Pool.Qin.UserData(netkey,data);
			
			Common.RegCallBack("心跳", "Act", [m_sMeNetKey], true, 30000);
		}
	}
}